package com.gcu.gcutools

import android.animation.Animator
import android.animation.AnimatorListenerAdapter
import android.view.View
import com.gcu.common.base.BaseActivity
import com.gcu.gcutools.databinding.ActivitySplashBinding

/**
 * Splash activity
 * 闪屏页
 * @constructor Create empty Splash activity
 */
class SplashActivity : BaseActivity<ActivitySplashBinding>() {

    override fun  initView() {
        //闪屏动画
        mBinding.lavSplashLottie.addAnimatorListener(object : AnimatorListenerAdapter() {
            override fun onAnimationEnd(animation: Animator?) {
                super.onAnimationEnd(animation)
                mBinding.lavSplashLottie.removeAnimatorListener(this)
                finish()
            }
        })

        //debug
        if (BuildConfig.DEBUG) {
            mBinding.ivSplashDebug.visibility = View.VISIBLE
            mBinding.ivSplashDebug.setText(BuildConfig.BUILD_TYPE.uppercase())
        } else {
            mBinding.ivSplashDebug.visibility = View.GONE
        }
    }

}